<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>bootstrap</title>
    <link rel="stylesheet" href="css/bootstrap.min.css">
</head>
<body>
<div class="dropdown" id="toggle_drop">
    <button class="btn btn-info" data-toggle="dropdown" id="dropdown">按钮</button>
    <ul class="dropdown-menu">
        <li>1</li>
        <li>2</li>
        <li>3</li>
    </ul>
</div>
<script src="js/jquery-3.6.0.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script>
    // $("#dropdown").dropdown();
    $("#toggle_drop").on('show.bs.dropdown',function(){
        alert(1);
    })
    $("#toggle_drop").on('hidden.bs.dropdown',function(){
        alert(2);
    })
</script>

</body>
</html>